
package jpoco.android;

import java.util.*;

import jpoco.client.*;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;

public class ProviderListView extends ListView
{
	protected AbstractListAdapter adapter;
	
	public ProviderListView(final Context context, List<ClientSettings> providers)
	{
		this(context);
		setProviders(providers);
	}

	public ProviderListView(Context context)
	{
		super(context);
		
	}

	public void setProviders(List<ClientSettings> providers)
	{
		adapter = new AbstractListAdapter(providers)
		{

			@Override
			public View getView(int position, View convertView, ViewGroup parent)
			{
				ClientSettings settings = (ClientSettings) this.getItem(position);
				
				return new ProviderView( ProviderListView.this.getContext(), settings);
			}
			
		};
		
		this.setAdapter(adapter);
		
	}


}
